<template>
   <div class="wai">
    <p>显示包括，超级低价</p>
        <div class="li">
            <p>
                <span :class="{active:currentindex==index}" @click="dian(index)" v-for="(item,index) in si" :key="index">{{item}}</span>
            </p>
            <ul>
                <li v-for="(item,index) in shuzu" :key="index" >
                    <img :src="item.picture" alt="">
                    <section>
                        <div>{{item.name}}</div>
                        <div>{{item.name}}{{item.unit}}</div>
                        <div>
                            <div class="left">
                                <span>爆爆团夹</span>
                                <p><span class="qian">￥{{item.min_price}}</span><span class="zhe" v-show="item.promotion_info">{{item.promotion_info}}</span></p>
                            </div>
                            <div class="right">
                                <button @click="qiang(item)">{{item.status==0 ? '马上抢':'已抢'}}</button>
                                <span>{{item.month_saled_content}}</span>
                            </div>
                        </div>
                    </section>
                </li>
            </ul>
        </div>

  </div> 
</template>
  
<script setup>
  import {lunbo,shangjia,baotuan} from '@/util/api'
  import { onMounted,ref } from 'vue'
  var currentindex=ref(0)
  var shuzu=ref([])
  var si=ref(['正在请购','上新预告'])
  var dian=(index)=>{
      currentindex.value=index
      baotuan({status:currentindex.value}).then(res=>{
      console.log(res.data.list)
      shuzu.value=res.data.list
  })
  }
  var qiang=(item)=>{
      item.status = !item.status
  }
  onMounted(()=>{
  baotuan({status:currentindex.value}).then(res=>{
      console.log(res.data.list)
      shuzu.value=res.data.list
  })
  })
</script>

  
<style scoped>
  li img{
    width: 100px;
}
li{
    display: flex;
    padding: 10px;
    background: white;
    margin-bottom:10px;
    /* border: 1px solid #cccccc; */
}
li>section{
    flex: 1;
    margin-left: 10px;
}
section>div:nth-child(1){
    font-size: 12px;
    color: #9999;
}
section>div:nth-child(2){
    font-size: 16px;
    color: black;
    font-weight: bold;
}
section>div:nth-child(3){
   display: flex;
   justify-content: space-between;
}
section>div:nth-child(3)>.right{
   display: flex;
  flex-direction: column;
  align-items: center;
}
section>div:nth-child(3)>.right>button{
 width: 100px;
 height: 40px;
 background: red;
 color: white;
 border: none;
border-radius: 20px;
}
section>div:nth-child(3)>.left>span{
  font-size: 12px;
  font-weight: bold;
  color: red;
}
section>div:nth-child(3)>.left>p{
  display: flex;
  align-items: center;
 

}
section>div:nth-child(3)>.left>p>.qian{
  font-size: 20px;
 margin-right: 5px;
  color: red;
}
section>div:nth-child(3)>.left>p>.zhe{
  font-size: 12px;
 padding: 3px;
 border: 1px solid red;
  color: red;
}
ul,li{
    list-style: none;
}
ul{
    padding-left:15px;
    padding-right: 15px;
}
.wai>p{
    height: 300px;
    color: white;
    font-size: 30px;
    font-weight: bold;
    text-align: center;
    line-height: 200px;
    background: linear-gradient( red,orange,white);
}
.li{
    width: 100%;
    height: 484px;
    position: absolute;
    top: 131px;
}
.li>ul{
    overflow: auto;
    height: 442px;
}
.li>p{
    padding: 15px;
    padding-top: 0;
    
}
.li>p>span{
  margin-right: 10px;
    font-size: 18px;
    color: white;
}
.li>p>.active{
 font-weight: bold;
}
  </style>